/* const express = require('express')
const app = express()

let mw = (req,res,next)=>{
    console.log('全局中间件')
    next()
}

app.use(mw)

app.get('/',(req,res)=>{
    res.send({
        msg:'express'
    })
})

app.get('/home',(req,res)=>{
    res.send({
        msg:'express'
    })
})

app.listen(8080,()=>{
    console.log('8080 running')
}) */

/* const express = require('express')
const app = express()

let mw = (req,res,next)=>{
    console.log('全局中间件')
    next()
}

app.use(mw)

app.get('/',(req,res)=>{
    res.send({
        msg:'express'
    })
})

app.get('/home',(req,res)=>{
    res.send({
        msg:'express'
    })
})

app.listen(8080,()=>{
    console.log('8080 running')
}) */

const express = require('express')
const app = express()

let mw = (req,res,next)=>{
    console.log('全局中间件')
    next()
}

app.use(mw)

app.get('/',(req,res)=>{
    res.send('express 全局这中间件')
})

app.listen(8080,()=>{
    console.log('8080 running')
})